package Dining_philosophers;

public class mycode_dining extends Thread
{

	/**Five chop sticks.**/
	static int[] chopsticks = {1,1,1,1,1};
	
	/**
	 * Constructor extends thread.
	 * @param the_args	---the name of current thread.
	 */
	public mycode_dining(String the_args)
	{
		super(the_args);
	}
	
	/**
	 * Runnable functions.
	 */
	public void run()
	{           
		this.getchopsticks();
	}
	
	public boolean left(final int the_number)
	{
		if(chopsticks[the_number]==1)
		{
			chopsticks[the_number] = 0;
			Log.out(this.getName() + " get the left chopstick.");
			return true;
		}
		else
		{
			Log.out(this.getName() + "'s left chopstick is taken by " + (the_number - 1) + "");
			return false;
		}
		
		
	}
	
	public void getchopsticks()
	{
		
	}
	/**
	 * @param args
	 */
	public static void main(String[] args)
	{
		// TODO Auto-generated method stub

	}

}
